<template>
    <div class="body hg_newboxwrap">
        <div class="hg_newbox">
            <div class="hg_newbox">
                <TechnologicalDev />
            </div>

            <div class="hg_newboxlef">
                <div class="hg_boxct_navbox">
                    <div class="hg_boxct_nav">
                        <ul class="hg_boxt_ul">
                            <li
                                :class="{
                                    hg_boxt_ulli_active:
                                        icur === '3403060170901738538',
                                }"
                                @click="turnNav('3403060170901738538', $event)"
                            >
                                <h1>各关科技动态</h1>
                                <p></p>
                            </li>
                            <li
                                :class="{
                                    hg_boxt_ulli_active:
                                        icur === '3403060204902863915',
                                }"
                                @click="turnNav('3403060204902863915', $event)"
                            >
                                <h1>经验交流</h1>
                                <p></p>
                            </li>
                            <li
                                :class="{
                                    hg_boxt_ulli_active:
                                        icur === '3403060228554544172',
                                }"
                                @click="turnNav('3403060228554544172', $event)"
                            >
                                <h1>科普之窗</h1>
                                <p></p>
                            </li>
                        </ul>

                        <div
                            class="hg_boxt_more"
                            @click="turnBlank(1, { categoryId: icur })"
                        >
                            <img
                                src="@/assets/img/hg/icon_arrow_right.png"
                                alt=""
                            />
                            <span>更多</span>
                        </div>
                    </div>
                </div>

                <div
                    v-for="(item, index) in dataList"
                    :key="index"
                    @click="turnBlank(2, { typeId: item.typeId, id: item.id })"
                    class="hg_liclass"
                    :class="{ hg_active: index === icurli }"
                    @mouseover="icurli = index"
                    @mouseleave="icurli = 0"
                >
                    <div class="hg_boxchildtop">
                        <div>
                            <div class="hg_boxct_rig" @click="turnBlank(2, {})">
                                <h1>
                                    {{ item.name }}
                                </h1>
                                <h2>
                                    <img
                                        src="@/assets/img/hg/icon_time.png"
                                        alt=""
                                    /><span>{{ item.publishTime }}</span>
                                </h2>
                                <h3>
                                    {{ item.cmsArticle.content }}
                                </h3>
                            </div>
                        </div>
                    </div>

                    <div class="hg_boxlist" @click="turnBlank(2, {})">
                        <a>
                            <i></i>
                            <span> {{ item.name }}</span>
                            <b>{{ item.publishTime }}</b>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import appUtil from '~/assets/utils/appUtil';
import TechnologicalDev from './PurchasingReportTo';
import { createNamespacedHelpers } from 'vuex';
const { mapActions } = createNamespacedHelpers('hgModule');
export default {
    name: 'test',
    data() {
        return {
            icur: '3403060170901738538',
            icurli: 0,
            dataList: [],
            title: '各关科技动态',
        };
    },
    mounted() {
        this.getdataList(1, 4, this.icur);
    },
    components: {
        TechnologicalDev,
    },
    methods: {
        ...mapActions(['getdataListsAsync']),
        turnNav(icurid, e) {
            this.title = e.target.innerHTML;
            this.icur = icurid;
            this.getdataList(1, 4, this.icur);
        },
        turnBlank(type, Parameters) {
            appUtil.routerUrl(type, Parameters, this.title, this.icur);
        },
        getdataList(pn, ps, categoryId) {
            this.getdataListsAsync({
                pn,
                ps,
                categoryId,
            }).then((res) => {
                this.dataList = res.data.dataList;
                for (let i = 0; i < this.dataList.length; i++) {
                    if (this.dataList[i].cmsArticle) {
                        this.dataList[
                            i
                        ].cmsArticle.content = appUtil.strIntercept(
                            this.dataList[i].cmsArticle.content
                        );
                    }
                }
            });
        },
    },
};
</script>

<style lang="scss" scoped>
.body {
    overflow: hidden;
}

.hg_newboxwrap {
    background: url('~/assets/img/hg/hgback.png') center bottom
        no-repeat;
    background-size: 100% auto;
    min-height: 408px;
}

.hg_newbox {
    width: 1200px;
    margin: 0 auto;

    .hg_liclass {
        overflow: hidden;
        .hg_boxchildtop {
            display: none;
        }
        .hg_boxlist {
            display: block;
        }
    }

    .hg_newboxlef {
        margin-right: 340px;
        background: #fff;

        .hg_boxct_navbox {
            height: 68px;
            overflow: hidden;
        }
        .hg_boxct_nav {
            height: 48px;
            border-bottom: 6px solid rgba(216, 216, 216, 0.5);
            line-height: 48px;

            .hg_boxt_ul {
                float: left;

                .hg_boxt_ulli_active {
                    h1 {
                        font-size: 18px;
                        font-weight: 600;
                        color: #094194;
                    }

                    p {
                        display: block;
                    }
                }

                li {
                    float: left;
                    margin-left: 20px;
                    margin-right: 5px;
                    cursor: pointer;

                    h1 {
                        font-size: 16px;
                        font-weight: 400;
                        color: #666666;
                    }

                    p {
                        background: url('~/assets/img/hg/icon_line.png')
                            center top no-repeat;
                        background-size: 111px 9px;
                        height: 20px;
                        display: none;
                    }
                }
            }

            .hg_boxt_more {
                float: right;
                line-height: 48px;
                margin-right: 10px;
                cursor: pointer;

                img {
                    float: right;
                    margin: 16px 5px 0 5px;
                }

                span {
                    float: right;
                }
            }
        }

        .hg_active {
            .hg_boxchildtop {
                display: block;
            }
            .hg_boxlist {
                display: none;
            }
        }

        .hg_boxchildtop {
            height: 148px;
            background: #f7f7f7;
            border-radius: 4px;
            padding: 0 20px;

            .hg_boxct_rig {
                width: 100%;
                float: left;
                cursor: pointer;
                h1 {
                    font-size: 20px;
                    font-weight: 600;
                    color: #333333;
                    line-height: 35px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    padding-right: 10px;
                }

                h2 {
                    font-size: 12px;
                    color: #aaa;
                    font-weight: normal;
                    height: 20px;
                    line-height: 20px;
                    margin: 11px auto;

                    img {
                        float: left;
                        margin: 4px 5px 0 2px;
                    }

                    span {
                        float: left;
                    }
                }

                h3 {
                    font-size: 14px;
                    font-weight: 400;
                    color: #555555;
                    line-height: 24px;

                    a {
                        font-size: 10px;
                        font-weight: 400;
                        color: #094191;
                        line-height: 26px;
                        float: right;
                    }
                }
            }
        }

        .hg_boxlist {
            padding: 0 20px;
            a {
                width: 100%;
                display: inline-block;
                border-bottom: 1px solid #eaeaea;
                height: 39px;
                line-height: 39px;
                cursor: pointer;

                i {
                    float: left;
                    width: 4px;
                    height: 4px;
                    background: #999999;
                    border-radius: 2px;
                    margin: 21px 10px 0 5px;
                }

                span {
                    float: left;
                    font-size: 14px;
                    font-weight: 400;
                    color: #333333;
                    max-width: 75%;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }

                b {
                    float: right;
                    font-size: 14px;
                    font-weight: 400;
                    color: #666666;
                    margin-right: 20px;
                }
            }
        }
    }

    .hg_newbox {
        width: 320px;
        float: right;
    }
}
</style>
